package com.gopay.common.domain.ep;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.domain.BaseEntity;

/**
 * 快捷支付API绑卡辅助信息表
 *
 * @author sh.jiao
 * @EpCardBindRecvAcctInfo.java
 * @2017-03-31 17:11 www.gopay.com.cn Inc.All rights reserved.
 */
@Entity
@Table(name = "EP_CARD_BIND_RECV_ACCT_INFO")
public class EpCardBindRecvAcctInfo extends BaseEntity {
    /**
     * 主键 快捷协议号
     */
    private String contractNo;
    /**
     * 收款方客户ID
     */
    private String merId;
    /**
     * 银行预留手机号
     */
    private String bindMobile;
    /**
     * 证件类型 01 身份证
     */
    private String certType;
    /**
     * 身份证号码
     */
    private String certNo;
    /**
     * 银行卡号码
     */
    private String bankAcctNum;
    /**
     * 持卡人姓名
     */
    private String bankAcctName;
    /**
     * 银行代码
     */
    private String bankCode;
    /**
     * 银行卡类型 0 借记卡 1 贷记卡
     */
    private String bankCardType;
    /**
     * 信用卡（贷记卡）有效期
     */
    private String creditCardExpired;
    /**
     * 绑定状态 0 解绑 1 绑定
     */
    private Integer bindState;
    /**
     * 创建时间
     */
    private Date createTs;
    /**
     * 最后修改时间
     */
    private Date lastUpdateTs;

    @Id
    @Column(name = "CONTRACT_NO", unique = true, nullable = false, length = 30)
    public String getContractNo() {
        return contractNo;
    }

    public void setContractNo(String contractNo) {
        this.contractNo = contractNo;
    }

    @Column(name = "MER_ID", nullable = false, length = 10)
    public String getMerId() {
        return merId;
    }

    public void setMerId(String merId) {
        this.merId = merId;
    }

    @Column(name = "BIND_MOBILE", nullable = false)
    public String getBindMobile() {
        this.bindMobile = SensitiveInfoUtils.autoReencrypt(this.bindMobile);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.bindMobile);
    }

    public void setBindMobile(String bindMobile) {
        this.bindMobile = SensitiveInfoUtils.smartEncryptWithCheck(bindMobile);
    }

    @Column(name = "CERT_TYPE", nullable = false, length = 2)
    public String getCertType() {
        return certType;
    }

    public void setCertType(String certType) {
        this.certType = certType;
    }

    @Column(name = "CERT_NO", nullable = false)
    public String getCertNo() {
        this.certNo = SensitiveInfoUtils.autoReencrypt(this.certNo);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.certNo);
    }

    public void setCertNo(String certNo) {
        this.certNo = SensitiveInfoUtils.smartEncryptWithCheck(certNo);
    }

    @Column(name = "BANK_ACCT_NUM", nullable = false)
    public String getBankAcctNum() {
        this.bankAcctNum = SensitiveInfoUtils.autoReencrypt(this.bankAcctNum);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.bankAcctNum);
    }

    public void setBankAcctNum(String bankAcctNum) {
        this.bankAcctNum = SensitiveInfoUtils.smartEncryptWithCheck(bankAcctNum);
    }

    @Column(name = "BANK_ACCT_NAME", nullable = false)
    public String getBankAcctName() {
        this.bankAcctName = SensitiveInfoUtils.autoReencrypt(this.bankAcctName);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.bankAcctName);
    }

    public void setBankAcctName(String bankAcctName) {
        this.bankAcctName = SensitiveInfoUtils.smartEncryptWithCheck(bankAcctName);
    }

    @Column(name = "BANK_CODE", nullable = false, length = 16)
    public String getBankCode() {
        return bankCode;
    }

    public void setBankCode(String bankCode) {
        this.bankCode = bankCode;
    }

    @Column(name = "BANK_CARD_TYPE", nullable = false)
    public String getBankCardType() {
        return bankCardType;
    }

    public void setBankCardType(String bankCardType) {
        this.bankCardType = bankCardType;
    }

    @Column(name = "CREDIT_CARD_EXPIRED")
    public String getCreditCardExpired() {
        this.creditCardExpired = SensitiveInfoUtils.autoReencrypt(this.creditCardExpired);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.creditCardExpired);
    }

    public void setCreditCardExpired(String creditCardExpired) {
        this.creditCardExpired = SensitiveInfoUtils.smartEncryptWithCheck(creditCardExpired);
    }

    @Column(name = "BIND_STATE", nullable = false)
    public Integer getBindState() {
        return bindState;
    }

    public void setBindState(Integer bindState) {
        this.bindState = bindState;
    }

    @Column(name = "CREATE_TS")
    public Date getCreateTs() {
        return createTs;
    }

    public void setCreateTs(Date createTs) {
        this.createTs = createTs;
    }

    @Column(name = "LAST_UPD_TS")
    public Date getLastUpdateTs() {
        return lastUpdateTs;
    }

    public void setLastUpdateTs(Date lastUpdateTs) {
        this.lastUpdateTs = lastUpdateTs;
    }
}
